package com.wx.utils;

import com.google.common.collect.Lists;

import java.io.Serializable;
import java.util.List;

/**
 * <p>Title:	  TreeNode. </p>
 * <p>Description 树vo </p>
 * <p>Company:    医百科技有限公司 </p>
 *
 * @Author <a href="xinglinglove1029@163.com"/>杨文生</a>
 * @CreateDate 2017/8/18 13:45
 */
public class TreeNode implements Serializable {

    private static final long serialVersionUID = -3528018867239913975L;

    private String id;

    private String parentId;

    List<TreeNode> children = Lists.newArrayList();

    public List<TreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<TreeNode> children) {
        this.children = children;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public void add(TreeNode node) {
        children.add(node);
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("TreeNode{");
        sb.append("id='").append(id).append('\'');
        sb.append(", parentId='").append(parentId).append('\'');
        sb.append(", children=").append(children);
        sb.append('}');
        return sb.toString();
    }
}
